from enum import Enum


class ErrorCodeEnum(Enum):

    NO_TARGET_SERVICE = "NO TARGET SERVICE"

    GET_FILE_PATH_ERROR = "GET_FILE_PATH_ERROR"

    BOOT_CTAF_ERROR = "BOOT ctaf_core ERROR"

    NO_CTAF_INSTANCE = "NO ctaf_core INSTANCE"

    DB_ACCESS_ERROR = "DB ACCESS ERROR"

    WS_DISCONNECT_ERROR = "WEBSOCKET DISCONNECT ERROR"

    ACCESS_BOOT_ERROR = "ACCESS BOOT ERROR"

    NO_LOCAL_SERVICE_CONTAINER = "NO LOCAL SERVICE CONTAINER"

    BUS_CALL_TIMEOUT = "BUS CALL TIMEOUT"

    BUS_CALL_ERROR = "BUS CALL ERROR"

def get_error_code_enum_by_value(value: str) -> ErrorCodeEnum | None:
    for item in ErrorCodeEnum:
        if item.value == value:
            return item
    return None